package com.tinckay.common.constant;

/**
 * @Author: Jean
 * @Desc: 常用正则表达式
 * @Date: 2018/10/31 16:32
 */
public class RegexConstant {

    /**
     * 匹配1或者0
     */
    public static final String ZERO_OR_ONE = "^[01]$";

    /**
     * 中文字符
     */
    public static final String CN_CHARACTER = "[\\u4e00-\\u9fa5]+";

    /**
     * 整数匹配
     */
    public static final String INTEGER = "^[0-9]*$";

    /**
     * Email地址
     */
    public static final String E_MAIL = "\\w[-\\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\\.)+[A-Za-z]{2,14}";

    /**
     * 网址URL
     */
    public static final String URL = "^((https|http|ftp|rtsp|mms)?:\\/\\/)[^\\s]+";

    /**
     * 手机验证
     * ^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$
     */
    public static final String MOBILE_PHONE = "^[1][3,4,5,6,7,8][0-9]{9}$";

    /**
     * 电话号码
     */
    public static final String TELEPHONE = "[0-9-()()]{7,18}";

    /**
     * 腾讯QQ
     */
    public static final String TENCENT_QQ = "[1-9]([0-9]{4,10})";

    /**
     * IP
     */
    public static final String IP = "(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)";

    /**
     * 身份证号码
     */
    public static final String ID_CARD_NO = "\\d{17}[\\d|x]|\\d{15}";

    /**
     * 用户名: 用户名正则，4到16位（字母，数字，下划线，减号）/^[a-zA-Z0-9_-]{5,16}$/
     */
    public static final String USER_NAME = "^[a-zA-Z0-9_-]{5,16}$";

    /**
     * 密码
     */
    public static final String PASS_WORD = "^([A-Z]|[a-z]|[0-9]|[`~!@#$%^&*()+=|{}':;',\\\\\\\\[\\\\\\\\].<>/?~！@#￥%……&*（）——+|{}【】‘；：”“'。，、？]){6,16}$";

    /**
     * 格式日期
     */
    public static final String DATE = "\\d{4}(\\-|\\/|.)\\d{1,2}\\1\\d{1,2}";

    /**
     * 年份正则表达式
     */
    public static String YEAR_REG = "([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})";

    /**
     * 日期
     */
    public static String DATE_REG = "^$|^((((1[6-9]|[2-9]\\d)\\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\\d|3[01]))|(((1[6-9]|[2-9]\\d)\\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\\d|30))|(((1[6-9]|[2-9]\\d)\\d{2})-0?2-(0?[1-9]|1\\d|2[0-8]))|(((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))$";
}
